# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: Ian Beringer <ian@ianberinger.com>

pkgname=python-kubernetes
_pkgbase="${pkgname#python-}"
pkgver=26.1.0
pkgrel=2
license=('Apache')
pkgdesc='Python client for the kubernetes API'
arch=('any')
url='https://github.com/kubernetes-client/python'
depends=('python' 'python-certifi' 'python-six' 'python-dateutil'
         'python-urllib3' 'python-yaml' 'python-google-auth'
         'python-websocket-client' 'python-requests' 'python-requests-oauthlib'
         'python-adal')
makedepends=('python-setuptools')
checkdepends=('python-pytest' 'python-pluggy' 'python-py' 'python-isort' 'python-nose')
source=("${_pkgbase}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('73bc8e450efb90ac680d8042d3498c873b6aec384db598cd829d8988db14d6f1')

prepare() {
  cd "${srcdir}"

  mv -v "python-${pkgver}" "${_pkgbase}-${pkgver}"
}

build() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py build
}

check() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  export PYTHONPATH="${PWD}"
  py.test -vvv -s --ignore=kubernetes/e2e_test
}

package() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py install --root="${pkgdir}" --optimize=1
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
